import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:s_mankey/config/resource_mananger.dart';
import 'package:s_mankey/config/router_config.dart';
import 'package:s_mankey/model/home_audio_model.dart';
import 'package:s_mankey/provider/provider_widget.dart';
import 'package:s_mankey/ui/widget/home_car_widget.dart';
import 'package:s_mankey/ui/widget/show_toast.dart';
import 'package:s_mankey/view_model/audio_vmodel.dart';
import 'package:s_mankey/view_model/home_vmodel.dart';

class HomeAudio extends StatefulWidget {

  final datas;

  HomeAudio({Key key, @required this.datas}) : super(key: key);

  @override
  _HomeAudioState createState() {
    return _HomeAudioState();
  }
}

class _HomeAudioState extends State<HomeAudio> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return HomeCardWidget(child:Padding(
        padding: EdgeInsets.fromLTRB(10, 5, 10, 5),
        child: Column(children: [
          Container
            (decoration: BoxDecoration(border: Border(bottom: BorderSide(color: AppColor.dividerColor))),
              child: Container(
                height: 40,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text('成长用听的'),
                    GestureDetector(onTap: (){
//                      Toast.toast(context,msg: '功能暂未开放');
                      Navigator.pushNamed(context, RouterName.audioList);
                    },child: Row(children: [
                      Text('更多',style: TextStyle(color: Color(0xffeb366c)),),
                      Icon(Icons.chevron_right,color: Color(0xffeb366c)),
                    ],),),

                  ],),)),

          GestureDetector(onTap: (){
            Navigator.pushNamed(context, RouterName.audioDetail, arguments: {'vid': widget.datas['id']});
          },child: Container(
            child: Row(children: [
              Icon(Icons.audiotrack,size: AppFontSize.Size26,),

              Expanded(child: Padding(
                padding: const EdgeInsets.all(10),
                child: Column(children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Expanded(child: Text(widget.datas['course_title'],style: TextStyle(color: Colors.black,fontSize: AppFontSize.Size16),maxLines: 1,),),
                      Text(widget.datas['language'],style: TextStyle(color:Color(0xff747474)),),
                      IconFonts.rightIcon,
                    ],),

                  Text(widget.datas['profile'],
                    style: TextStyle(color: Color(0xff747474),),maxLines: 2,overflow: TextOverflow.ellipsis,)

                ],),
              ),),

              Icon(Icons.play_circle_filled),

            ],),
          ),),

        ],),
      ));
  }
}